package io.kiki.stack.netty.channelManager;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Setter
@Getter
public class CreateChannelTask implements Runnable {
    private final ReconnectManager reconnectManager;
    Url url;

    public CreateChannelTask(ReconnectManager reconnectManager, Url url) {
        this.reconnectManager = reconnectManager;
        this.url = url;
    }

    @Override
    public void run() {
        try {
            reconnectManager.channelManager.createChannelAndHealIfNeed(url);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
